This page last changed on Jun 16, 2006 by tcarlson.

Mule can be configured to use and manage any object from external containers or Naming Directories such as Jndi, Ejb, Spring, Pico, Plexus, or HiveMind.

Supported Containers

Configuring Containers

You can configure zero or more containers in a single Mule instance using the <container-context> element.

<container-context name="jndi" className="org.mule.impl.container.JndiContainerContext">
    <properties>
        <property name="java.naming.factory.initial"
             value="org.foo.jndi.InitialContextFactory"/>
    </properties>
</container-context>

This will configure a Jndi container. By default, when looking up an object Mule will search each of the containers in the order they are configured.
Notice the name attribute; this is optional but allows you to reference a particular container when setting a container property (see below). Each type of container has its own default name such as 'jndi', 'ejb', 'spring', 'pico' or 'plexus' . The only time you might want to set the name attribute yourself is if you have 2 jndi containers that contain objects of the same name and you need to distinguish between the two.

Configuring Container Properties

Managing Container objects

Mule services can be objects configured in an object container. To expose a container objects as a Mule service you need to set the implmenetation attribute of the <mule-descriptor> element to the name of the object to look up. Optionally, You can also set the container attribute to specify which container to load the object from.

<mule-descriptor name="MyComponent" implementation="myJndiObject" container="jndi">
    ....
</mule-descriptor>

Container Properties

Any object specifed in Mule Xml that has a <properties> element can reference objects in containers as properties. These are properties that are retrieved from a configured IoC or Naming container, such as Spring, Jndi or EJB.

<properties>
    <container-property name="testProperty" reference="testBean" required="true" container="jndi"/>
</properties>
Attribute Description
name specifies the bean property name. If the object has methods setTestProperty(..) and getTestProperty() the property name is testProperty.
reference The reference name of the object in the container.
required Determines whether an exception is thrown if the object reference is not found in the container. The default is true.
container An optional attribute that tells Mule only to look for the object in the specifed container, otherwise Mule will search all containers in the order they are configured.
Document generated by Confluence on Nov 27, 2006 10:27